/**
 * 微课堂
 */
import type { GetMicroclassDetailParams, GetMicroclassDetailResult, GetMicroclassListParams, GetMicroclassListResult, getCategoryResult } from './type';
import { get, post } from '@/utils/request';

enum URL {
  getMicroclassList = '/app/microclass/microclassList',
  getMicroclassDetail = '/app/microclass/microclassDetail',
  getCourseInfo = '/app/microclass/courseInfo',
  getCategory = '/tk/custCourses/category',
}

// 微课堂列表
export const getMicroclassList = (data: GetMicroclassListParams) => get<{ total: number; rows: Array<GetMicroclassListResult> }>({ url: URL.getMicroclassList, data });
// 微课堂详情
export const getMicroclassDetail = (data: GetMicroclassDetailParams) => get<{ total: number; rows: Array<GetMicroclassDetailResult> }>({ url: URL.getMicroclassDetail, data });

// 课程信息
export const getCourseInfo = (data: { courseId: string | number }) => post<any>({ url: URL.getCourseInfo, data });

// 课程分类
export const getCategory = (data: { categoryId: string }) => post<getCategoryResult[]>({ url: URL.getCategory, data });
